#!/bin/bash
#使用docker搭建gitlab
URL=$1
docker pull gitlab-ce

mkdir -p /srv/gitlab/config

mkdir -p /srv/gitlab/logs

mkdir -p /srv/gitlab/data
DOCKER_ID=$(docker run --detach   --hostname $URL --publish 443:443 --publish 8001:80 --publish 23:23 --privileged=true  --name gitlab   --restart always  --volume /srv/gitlab/config:/etc/gitlab  --volume /srv/gitlab/logs:/var/log/gitlab  --volume /srv/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest /sbin/init)
docker exec $DOCKER_ID "gitlab-ctl restart"
